/**
 * @description 
 * 
 * Copyright (c) 2015-2017 zhangxingong,Inc.All Rights Reserved.
 * update by liaoshengjun 2017-10-19
 */
package com.vcredit.creditcat.manager.admin;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import com.vcredit.creditcat.model.ChannelStatisticsOwner;
import com.vcredit.creditcat.service.ChannelStatisticsOwnerService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.dubbo.config.annotation.Service;
import com.vcredit.creditcat.api.IChinaleSuceTaskManager;

@Service(protocol = { "protocol1" }, version = "1.0")
public class ChinaleSuceTaskManager implements IChinaleSuceTaskManager {

	@Autowired
	private ChannelStatisticsOwnerService channelStatisticsOwnerService;

	private static Logger logger = LoggerFactory.getLogger(ChinaleSuceTaskManager.class);
	// 参数定义

	@Override
	public void queryChinale() throws Exception {
		logger.info("开始查询渠道统计！！");
		try {
//			ChannelStatisticsOwner paramObj=new ChannelStatisticsOwner();
//			Calendar calendar=Calendar.getInstance();
//			calendar.add(Calendar.DAY_OF_YEAR,-1);
//			Date date=calendar.getTime();
//			String yesterday=new SimpleDateFormat("yyyy-MM-dd").format(date);
//			paramObj.setStatisticalStartTime(yesterday);
//			List<ChannelStatisticsOwner> list=channelStatisticsOwnerService.find(paramObj);
//			//如果当天已有数据则不插入数据
//			if(list!=null && list.size()>0)return;
			channelStatisticsOwnerService.insertData();
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("渠道统计失败~！", e);
		}
	}

}
